package com.fanshuai2.niuke.strings;
import java.util.*;

public class StringsJoin {
    static String process(String a, String b) {
        a = a + b;
        char[] ch = a.toCharArray();

        int len = ch.length;
        char[] ch2 = new char[len / 2];
        char[] ch1 = new char[len - len / 2];

        for (int i = 0, j = 0, k = 0; i < len; i++) {
            if (i % 2 == 0) {
                ch1[j] = ch[i];
                j++;
            } else {
                ch2[k] = ch[i];
                k++;
            }
        }
        Arrays.sort(ch1);
        Arrays.sort(ch2);

        int j = 0;
        int k = 0;
        for (int i = 0; i < len; i++) {
            if (i % 2 == 0) {
                ch[i] = ch1[j];
                j++;
            } else {
                ch[i] = ch2[k];
                k++;
            }
        }

        for (int i = 0; i < len; i++) {
            char c = ch[i];
            ch[i] = processChar(c);
        }

        return new String(ch);
    }

    static char processChar(char c) {
        boolean transfer = c >= '0' && c <= '9' ||
                c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F';

        if (!transfer) {
            return c;
        }
        int v = 0;
        if (c >= '0' && c <= '9') {
            v = c - '0';
        } else if (c >= 'a' && c <= 'f') {
            v = 10 + c - 'a';
        } else if (c >= 'A' && c <= 'F') {
            v = 10 + c - 'A';
        }
        String binary = Integer.toBinaryString(v);
        while (binary.length() < 4) {
            binary = "0" + binary;
        }
        String bReverse = new StringBuilder(binary).reverse().toString();

        int newValue = 0;
        for (char cc : bReverse.toCharArray()) {
            int binaryValue = cc - '0';
            newValue = newValue * 2 + binaryValue;
        }
        char newC = '#';
        if (newValue >= 0 && newValue <= 9) {
            newC = (char) (newValue + '0');
        } else if (newValue >= 10 && newValue <= 15) {
            newC = (char) ('A' + newValue - 10);
        }

        return newC;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        while (in.hasNext()) {
            String a = in.next();
            String b = in.next();
            System.out.println(process(a, b));
        }
    }
}
